home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigantic Games 2
/
Gigantic Games 2.iso
/
pc
/
_g_
/
gold
/
gold.doc
< prev
next >
Wrap
Text File
|
1994-12-23
|
14KB
|
327 lines
GoLD: GAME OF LIFE - DUO
========================
by
Andreas Neubacher
January, 1992
1. OVERVIEW (or: Let's see what we can do in the commercial style.)
===================================================================
GoLD is an innovative new "Game of Life" implementation. What makes it
different is having two kinds of cells compete with each other for living
space.
GoLD allows free redefinition of the rules with a few mouseclicks, so
that a multitude of interesting phenomena like parasitism, virus attacks,
etc. can be simulated.
GoLD also boasts a nice icon, full mousecontrol, highly optimized
assembler subroutines to speed up computation, and a 2 player game mode.
GoLD comes packaged with complete, well documented source enabling you
to rebuild the executable and clear, extensive documentation.
GoLD is free of any copy protection or password check. As a special
bonus all files of the package may be distributed freely via any medium you
can think of. Use of the program does not require the payment of license or
shareware fees or sending a postcard or e-mail to the author.
2. WHAT IS THE "GAME OF LIFE"? (or: I know it is a cellular automaton but
=========================================================================
I'm not interested in Theoretical Computer Science.)
====================================================
2.1. The classic version
------------------------
The game is played on an arbitrarily large, two-dimensional matrix. Its
cells can exist in one of the two states "dead" or "alive". During every
turn the following three rules are applied to each cell:
- If the cell is "dead" and exactly three of the eight neighbouring cells
are "alive", the cell is "alive" at the beginning of the next turn.
- If the cell is "alive" and less than two or more than three neighbouring
cells are "alive", the cell is "dead" at the beginning of the next turn.
- Otherwise, the state of the cell does not change.
This simple set of rules already creates astonishing complex patterns from
simple ones (e.g. the R-Pentomino which grows from 5 cells to more than
200) and allows for strange behaviour of certain cell colonies (e.g. the
Glider which moves one cell right and down every four turns):
..O .OO
O.O Glider OO. R-Pentomino
.OO .O.
2.2 The GoLD version
--------------------
GoLD extends the number of states to three: "blue", "black", and "red" with
values -1, 0, and +1, respectively. During every turn the values of the
eight neighbouring cells are added up for each cell. Using this sum and the
current state of the cell, the new state of the cell is looked up in a
"Transformation Table". This makes for an pretty large number (3 to the
power of 51) of different rule sets, one of which corresponds to the rules
of the classic version.
Below is the transformation table for the classic rules as an example:
+------------+--------------------------------------------------+
| | Sum of values of neighbouring cells |
| Old state | |
| |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| blue "BL" | | | | | |BL|BL| | | | | | | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| black " " | | | | | |BL| | | | | |RD| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| red "RD" | | | | | | | | | | |RD|RD| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Rows correspond to the state of the cell currently being checked, columns
correspond to the sum of the values of this cells neighbours (with blue
ones counting as -1, black ones counting as 0, and red ones counting as +1)
and the entries of the table give the new state of the cell at the
beginning of the next turn ("BL" for blue, " " for black, and "RD" for
red).
For example, the entry "RD" in the middle "black" row and the column
denoted "+3" means that a black ("dead") cell changes to red ("alive") if
it has exactly three red neighbours and no blue ones (+3-0 = +3), or four
red neighbours and one blue one (+4-1 = +3), or five red neighbours and two
blue ones (+5-2 = +3).
So if there are only cells of one color on the playfield, the above
table lets them behave as in the classic game. This is also the default
transformation table, which can be changed with the "Rules" menu option
(see Section 3.2.).
3. INSTRUCTIONS FOR USE (or: Assume we have never seen a mouse before.)
=======================================================================
3.1. The Screen
---------------
The lower three quarters of the screen consist of the playfield, a matrix
of size 160 x 60. From now on it will be called "Agar" (from "agar agar", a
culture medium for cells).
If the mouse pointer is in this area of the screen, pressing the left
button sets cells of the chosen strain while pressing the right button
clears cells of the chosen strain.
In the upper quarter of the screen there are three gadgets:
- Clicking "Strain 1" and "Strain 2" toggle the chosen strain, which is
indicated by a frame around the corresponding gadget.
- Pressing the left button while the mouse pointer is on the "Grow" gadget
starts the computation of turns, which continues until the button is
released again.
For each of the two strains two values are printed below their
corresponding gadget:
- "Cells on Agar" shows how many cells of this strain there are on the
playfield.
- "Cells in Freezer" shows how many cells there are in storage off the
playfield. You can only set cells onto the Agar as long as there are
cells in the Freezer. Cells which are cleared from the Agar by pressing
the right mouse button are moved to the Freezer.
3.2. The Menus
--------------
When the mouse pointer is not located on the Agar, the right mouse button
activates the menus:
3.2.1 The "Project" Menu
------------------------
- "About" activates the "About" requester which also appears at startup.
- "Rules" shows a requester which contains the transformation table
explained in section 2.2. Clicking an "X" toggles its color (blue - black
- red).
- "Reset" clears the Agar and activates a requester with two gadgets for
each strain:
- "Cells in Freezer" gives the initial number of cells in the Freezer.
- "Growth in Freezer" gives the number of cells which are added to the
Freezer after every turn. See Section 4.2. for an explanation why the
concept of the Freezer was introduced.
- "Quit" ends the program.
3.2.2. The "Edit" Menu
----------------------
- "Undo" resets the Agar to the state it was in before the latest
activation of the "Grow" gadget or editing of the Agar.
- "Clear Agar" sets all cells in the Agar to the color black.
4. PLAYING SUGGESTIONS (or: I don't know what you can do with it, either.)
==========================================================================
4.1. Single Player
------------------
Just draw some random patterns of cells of both colors, let them grow a
bit, change the rules, let them grow again, etc. The following tables may
provide a starting point for your intuition w.r.t. interesting rules:
Some nice symmetry - just place 5 to 10 clusters of about 10 cells on the
Agar:
+------------+--------------------------------------------------+
| | Sum of values of neighbouring cells |
| Old state | |
| |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| blue "BL" | | | | | |BL|BL| | | | | | | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| black " " | | | | | |BL|BL| | | |RD|RD| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| red "RD" | | | | | | | | | | |RD|RD| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Another symmetric rule - just place a single cell of each color on the Agar
and watch how they develop and how the interaction of the two strains
destroys the symmetry:
+------------+--------------------------------------------------+
| | Sum of values of neighbouring cells |
| Old state | |
| |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| blue "BL" | | | | | | | | | | | | | | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| black " " | | | | | | | |BL| |RD| | | | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| red "RD" | | | | | | | | | | | | | | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Blue is some kind of virus - it grows from healthy red cells and never
dies:
+------------+--------------------------------------------------+
| | Sum of values of neighbouring cells |
| Old state | |
| |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| blue "BL" |BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| black " " | | | | | | | | | | |RD|RD| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| red "RD" | | | | | | | | | | |RD|RD|BL| | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Another virus, but this one's even deadlier - start with the entry in the
"black" row, "+3" column set to RD, grow red cells until they nearly fill
the screen and then toggle just this entry to blue and watch how fast the
red cells are transformed. It is also interesting to watch the evolution of
a square of 2x2 red cells according to these rules:
+------------+--------------------------------------------------+
| | Sum of values of neighbouring cells |
| Old state | |
| |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| blue "BL" |BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| black " " | | | | | | | | | | |RD|BL| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| red "RD" | | | | | | | | | | |RD|RD| | | | | |
+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
I cannot recommend trying to design certain patterns of cells with special
behaviour. GoLD was rather written for experimenting with the rules. This
might change if somebody (No, not me!) added a "Zoom" option to the "Edit"
menu and a "Cluster" menu with "Copy", "Paste", and "Save" options ...
4.2. Two Players ("Game mode")
------------------------------
The concept of the Freezer (see Section 3) was introduced to allow for some
kind of two player competition:
Using the "Project" menu option "Reset" you choose an initial number of
cells for each player.
Blue starts by setting some cells on the Agar. Then the "Grow" gadget
is activated for some fixed number of turns. Now it's red's turn, who also
sets some cells and then activates the "Grow" gadget. The game continues in
this fashion until one of the players neither has cells on the Agar nor in
the Freezer.
Complexity can be enhanced by allowing the players to optionally modify
the rules (e.g. by at most two mouse clicks) instead of editing the cells
on the Agar.
5. COMPILING (or: You have the executable, why would you want to recompile?)
============================================================================
GoLD was written using the DICE Compiler, which can be found in the Fish
Library. Compilation is done by
>dcc GoLD.c GoLDSub.a -o GoLD
The source should be completely compatible to the Lattice/SAS C Compiler.
With Aztec you may have some problems:
- In "GoLDSub.a" the "section GoLDSub,code" statement must be replaced by
"CSEG" and the "xdef" statements must be replaced by "PUBLIC" according
to some obscure sources who claim to have knowledge of these things.
- Possibly the "dbf" opcode should be "dbra" for the Aztec Assembler and
the compiler might not push all function parameters as 32 bit values on
the stack (compiling with the option which sets integers to 32 bits might
help).
I neither have Lattice nor Aztec, so I could not test for compatibility.
6. DISCLAIMER (or: Yes, this software is really free.)
======================================================
Apart from the claim that I (see my address below) toiled uncounted hours
developing this extraordinary piece of software, I don't reserve any rights
or claim any kind of copyright for GoLD.
I wrote this for fun and out of interest, and I am using such a lot of
Public Domain software that I thought I should donate something, too.
If you paid more than a moderate copying fee for GoLD ("moderate" being
in the range of what Fred Fish charges), then
(1) you won't be able to read this sentence because the distributor removed
it, and
(2) you got ripped off and should try to find some other source for Public
Domain Software.
7. THE AUTHOR'S ADDRESS (or: No, I don't expect any fanmail.)
=============================================================
Andreas Neubacher
Hausleitnerweg 26
4020 Linz
Austria
e-mail: aneubach@risc.uni-linz.ac.at (Internet)
k318577@alijku11 (Bitnet)